package flex.base
{
	import flash.display.DisplayObject;
	
	import mx.managers.PopUpManager;

	public final class WinHelper
	{
		/**
		 * 打开一个模态窗口
		 * */
		public static function ShowModalWindow(parent:DisplayObject,windowClass:Class):FshBaseTitleWindow{
			var form:FshBaseTitleWindow = FshBaseTitleWindow(PopUpManager.createPopUp(parent,windowClass,true));
			form.x = (parent.stage.stageWidth - form.width) / 2;
			form.y = (parent.stage.stageHeight - form.height) / 2;
			if(form.title=="")
			{
				form.title = "对话窗口";
			}
			return form;
		}
		
		/**
		 * 打开一个非模态窗口
		 * */
		public static function ShowNormalWindow(parent:DisplayObject,windowClass:Class):FshBaseTitleWindow{
			var form:FshBaseTitleWindow = FshBaseTitleWindow(PopUpManager.createPopUp(parent,windowClass,false));
			form.x = (parent.stage.stageWidth - form.width) / 2;
			form.y = (parent.stage.stageHeight - form.height) / 2;
			if(form.title=="")
			{
				form.title = "对话窗口";
			}
			return form;
		}
	}
}